home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / addico1a / form1.frm < prev    next >
Text File  |  1999-10-07  |  5KB  |  163 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   1725
  5.    ClientLeft      =   165
  6.    ClientTop       =   735
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1725
  10.    ScaleWidth      =   4680
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.Image imgDelete 
  13.       Height          =   240
  14.       Left            =   3600
  15.       Picture         =   "Form1.frx":0000
  16.       Top             =   960
  17.       Visible         =   0   'False
  18.       Width           =   750
  19.    End
  20.    Begin VB.Image imgExit 
  21.       Height          =   240
  22.       Left            =   2640
  23.       Picture         =   "Form1.frx":0242
  24.       Top             =   960
  25.       Visible         =   0   'False
  26.       Width           =   540
  27.    End
  28.    Begin VB.Image imgCaution 
  29.       Height          =   240
  30.       Left            =   2640
  31.       Picture         =   "Form1.frx":0944
  32.       Top             =   600
  33.       Visible         =   0   'False
  34.       Width           =   825
  35.    End
  36.    Begin VB.Image imgYield 
  37.       Height          =   240
  38.       Left            =   1800
  39.       Picture         =   "Form1.frx":0B86
  40.       Top             =   960
  41.       Visible         =   0   'False
  42.       Width           =   645
  43.    End
  44.    Begin VB.Image imgStop 
  45.       Height          =   240
  46.       Left            =   1800
  47.       Picture         =   "Form1.frx":0D88
  48.       Top             =   600
  49.       Visible         =   0   'False
  50.       Width           =   615
  51.    End
  52.    Begin VB.Menu mnuFile 
  53.       Caption         =   "&File"
  54.       Begin VB.Menu mnuFileExit 
  55.          Caption         =   "E&xit"
  56.       End
  57.    End
  58.    Begin VB.Menu mnuData 
  59.       Caption         =   "&Data"
  60.       Begin VB.Menu mnuDataDelete 
  61.          Caption         =   "&Delete"
  62.       End
  63.       Begin VB.Menu mnuDataOptions 
  64.          Caption         =   "&Options"
  65.          Begin VB.Menu mnuDataOptionsStop 
  66.             Caption         =   "Stop"
  67.          End
  68.          Begin VB.Menu mnuDataOptionsYield 
  69.             Caption         =   "Yield"
  70.          End
  71.          Begin VB.Menu mnuDataOptionsCaution 
  72.             Caption         =   "Caution"
  73.          End
  74.       End
  75.    End
  76. End
  77. Attribute VB_Name = "Form1"
  78. Attribute VB_GlobalNameSpace = False
  79. Attribute VB_Creatable = False
  80. Attribute VB_PredeclaredId = True
  81. Attribute VB_Exposed = False
  82. Option Explicit
  83.  
  84. ' API stuff for putting bitmaps in menus.
  85. Private Type MENUITEMINFO
  86.     cbSize As Long
  87.     fMask As Long
  88.     fType As Long
  89.     fState As Long
  90.     wid As Long
  91.     hSubMenu As Long
  92.     hbmpChecked As Long
  93.     hbmpUnchecked As Long
  94.     dwItemData As Long
  95.     dwTypeData As Long
  96.     cch As Long
  97. End Type
  98. Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
  99. Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
  100. Private Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal bypos As Long, lpcMenuItemInfo As MENUITEMINFO) As Long
  101. Private Const MF_BITMAP = &H4&
  102. Private Const MFT_BITMAP = MF_BITMAP
  103. Private Const MIIM_TYPE = &H10
  104.  
  105. Private Sub Form_Load()
  106.     ' Set the menu bitmaps.
  107.     SetMenuBitmap Me, Array(0, 0), imgExit.Picture
  108.     SetMenuBitmap Me, Array(1, 0), imgDelete.Picture
  109.     SetMenuBitmap Me, Array(1, 1, 0), imgStop.Picture
  110.     SetMenuBitmap Me, Array(1, 1, 1), imgYield.Picture
  111.     SetMenuBitmap Me, Array(1, 1, 2), imgCaution.Picture
  112. End Sub
  113. ' Put a bitmap in a menu item.
  114. Public Sub SetMenuBitmap(ByVal frm As Form, ByVal item_numbers As Variant, ByVal pic As Picture)
  115. Dim menu_handle As Long
  116. Dim i As Integer
  117. Dim menu_info As MENUITEMINFO
  118.  
  119.     ' Get the menu handle.
  120.     menu_handle = GetMenu(frm.hwnd)
  121.     For i = LBound(item_numbers) To UBound(item_numbers) - 1
  122.         menu_handle = GetSubMenu(menu_handle, item_numbers(i))
  123.     Next i
  124.  
  125.     ' Initialize the menu information.
  126.     With menu_info
  127.         .cbSize = Len(menu_info)
  128.         .fMask = MIIM_TYPE
  129.         .fType = MFT_BITMAP
  130.         .dwTypeData = pic
  131.     End With
  132.  
  133.     ' Assign the picture.
  134.     SetMenuItemInfo menu_handle, _
  135.         item_numbers(UBound(item_numbers)), _
  136.         True, menu_info
  137. End Sub
  138.  
  139.  
  140. Private Sub mnuDataDelete_Click()
  141.     MsgBox "Delete"
  142. End Sub
  143.  
  144. Private Sub mnuDataOptionsCaution_Click()
  145.     MsgBox "Caution"
  146. End Sub
  147.  
  148. Private Sub mnuDataOptionsStop_Click()
  149.     MsgBox "Stop"
  150. End Sub
  151.  
  152.  
  153. Private Sub mnuDataOptionsYield_Click()
  154.     MsgBox "Yield"
  155. End Sub
  156.  
  157.  
  158. Private Sub mnuFileExit_Click()
  159.     Unload Me
  160. End Sub
  161.  
  162.  
  163.